<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/view/jsp/public/include.base.jsp" %>
<%@ taglib prefix="spring" uri="/WEB-INF/taglib/spring.tld" %>
<!DOCTYPE html>
<!--[if IE 8]> <html class="ie8"> <![endif]-->
<!--[if IE 9]> <html class="ie9 gt-ie8"> <![endif]-->
<!--[if gt IE 9]><!-->
<html class="gt-ie8 gt-ie9 not-ie"> <!--<![endif]-->
<head>
    <title>娃娃机运营系统</title>
    <jsp:include page="/WEB-INF/view/jsp/public/include.inc.top.jsp" flush="true"/>
    <script type="text/javascript">
        //		if (window != top)
        //			top.location.href = location.href;
        //
        //		function frameLoad(url,obj){
        //			$('#main_content').attr('src',contextPath + url);
        //			if($('.mmc-title').css('display') === "block"){
        //				$('.mmc-title').parent('ul').css('display','none');
        //				$('.mmc-title').parent('ul').removeClass('mmc-dropdown-open-ul');
        //			}
        //			setTimeout(function(){
        //				window.PixelAdmin.MainMenu.prototype.detectActiveItem();
        //				activePageHeader(obj);
        //			},1000);
        //
        //		}
        //
        //		function frameHeight(){
        //			var ifm = $('#main_content');
        //			var subWeb = document.frames ? document.frames["mainFrame"].document : ifm[0].contentDocument;
        //			if (ifm != null && subWeb != null){
        //				if($(subWeb.body).hasClass('panel-expand'))
        //					return;
        //				ifm.removeAttr('height');
        //				ifm[0].height = $(subWeb.body).height();
        //			}
        //		}


    </script>
</head>

<script src="${contextPath}/js/biz/user/pwd.v1.js" type="text/javascript" ></script>
<body class="theme-default main-menu-animated">

<div id="main-wrapper">


    <div id="main-navbar" class="navbar navbar-inverse" role="navigation">
        <!-- Main menu toggle -->
        <button type="button" id="main-menu-toggle"><i class="navbar-icon fa fa-bars icon"></i><span
                class="hide-menu-text">HIDE MENU</span></button>

        <div class="navbar-inner">
            <!-- Main navbar header -->
            <div class="navbar-header">

                <!-- Logo -->
                <a href="${pageContext.request.contextPath}/index" class="navbar-brand">
                    <div><img alt="Pixel Admin"
                              src="${pageContext.request.contextPath}/resource/assets/pixel-admin/images/pixel-admin/main-navbar-logo.png">
                    </div>
                    娃娃机运行系统
                </a>

                <!-- Main navbar toggle -->
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                        data-target="#main-navbar-collapse"><i class="navbar-icon fa fa-bars"></i></button>

            </div>
            <!-- / .navbar-header -->

            <div id="main-navbar-collapse" class="collapse navbar-collapse main-navbar-collapse">
                <div>


                    <div class="right clearfix">
                        <ul class="nav navbar-nav pull-right right-navbar-nav">

                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle user-menu" data-toggle="dropdown">
                                    <img src="${pageContext.request.contextPath}/resource/template/style1/avatars/1.jpg"
                                         alt="">
                                    <span>${username}</span>
                                </a>
                                <ul class="dropdown-menu">
                                    <li><a href="javascript:void(0);" onclick="pwd.setPwd()"><i class="dropdown-icon fa fa-cog" ></i>&nbsp;&nbsp;密码修改</a></li>
                                    <li class="divider"></li>
                                    <li><a href="javascript:void(0);" onclick="logoutFun()"><i
                                            class="dropdown-icon fa fa-power-off"></i>&nbsp;&nbsp;登出</a></li>
                                </ul>
                            </li>
                        </ul>
                        <!-- / .navbar-nav -->
                    </div>
                    <!-- / .right -->
                </div>
            </div>
            <!-- / #main-navbar-collapse -->
        </div>
        <!-- / .navbar-inner -->
    </div>
    <!-- / #main-navbar -->
    <!-- /2. $END_MAIN_NAVIGATION -->

    <div id="main-menu" role="navigation">
        <div id="main-menu-inner">
            <!-- 此处是菜单头像 -->
            <div class="menu-content top" id="menu-content-welcome">
                <!-- Menu custom content demo
					 CSS:        styles/pixel-admin-less/demo.less or styles/pixel-admin-scss/_demo.scss
					 Javascript: html/${pageContext.request.contextPath}/resource/template/style1/demo.js
				 -->
                <div>
                    <div class="text-bg" style="padding-top:20px;">
                        <span class="text-slim">欢迎,</span>
                        <span class="text-semibold">${username}</span>
                    </div>

                    <img src="${pageContext.request.contextPath}/resource/template/style1/avatars/1.jpg" alt=""
                         class="">

                    <%--<div class="btn-group">
                        <a href="#" class="btn btn-xs btn-primary btn-outline dark"><i class="fa fa-envelope"></i></a>
                        <a href="#" class="btn btn-xs btn-primary btn-outline dark"><i class="fa fa-user"></i></a>
                        <a href="#" class="btn btn-xs btn-primary btn-outline dark"><i class="fa fa-cog"></i></a>
                        <a href="javascript:void(0)" onclick="logoutFun()"
                           class="btn btn-xs btn-danger btn-outline dark"><i class="fa fa-power-off"></i></a>
                    </div>--%>
                    <a href="#" class="close">&times;</a>
                </div>
            </div>
            <ul class="navigation">
                <li>
                    <a href="javascript:void(0);" id="home" site="/home" onclick="load('/home',this)"><i
                            class="menu-icon fa fa-home"></i><span class="mm-text">首页</span></a>
                </li>
                <!-- 导航开始 -->
                <c:forEach items="${menus}" var="item">
                    <li class="mm-dropdown">
                        <a href="#">
                                ${item.icon}
                                <%--<span><spring:message code="${item.code}"/></span>--%>
                            <span class="mm-text">${item.name}</span>
                        </a>
                        <c:if test="${not empty item.children}">
                            <ul>
                                <c:forEach items="${item.children }" var="menu">
                                    <%--<li><a href="javascript:openMainContent('${menu.url}')" ><spring:message code="${menu.code}"/></a></li>--%>
                                    <li <c:if test="${not empty menu.children}">class="mm-dropdown"</c:if>>
                                        <a tabindex="-1" href="javascript:void(0);" site="${menu.url}"
                                           <c:if test="${empty menu.children}">onclick="load('${menu.url}',this)"</c:if> >${menu.icon}
                                            <span class="mm-text">${menu.name}</span><%--${menu.code}--%>
                                        </a>

                                        <c:if test="${not empty menu.children}">
                                            <ul>
                                                <c:forEach items="${menu.children }" var="sub">
                                                    <%--<li><a href="javascript:openMainContent('${menu.url}')" ><spring:message code="${menu.code}"/></a></li>--%>
                                                    <li>
                                                        <a tabindex="-1" href="javascript:void(0);" site="${sub.url}"
                                                           onclick="load('${sub.url}',this)">${sub.icon}
                                                            <span class="mm-text">${sub.name}</span><%--${menu.code}--%>
                                                        </a>
                                                    </li>
                                                </c:forEach>
                                            </ul>
                                        </c:if>
                                    </li>
                                </c:forEach>
                            </ul>
                        </c:if>
                    </li>
                </c:forEach>
                <!-- 导航结束 -->
            </ul>
            <!-- / .navigation -->
            <%--<div class="menu-content">
                <a href="pages-invoice.html" class="btn btn-primary btn-block btn-outline dark">Create Invoice</a>
            </div>--%>
        </div>
        <!-- / #main-menu-inner -->
    </div>
    <!-- / #main-menu -->
    <!-- /4. $MAIN_MENU -->
    <!-- begin row -->

    <div id="content-wrapper">
        <%--<ul class="breadcrumb breadcrumb-page">
            <div class="breadcrumb-label text-light-gray">You are here: </div>
            <li><a href="#">Home</a></li>
            <li class="active"><a href="#">Dashboard</a></li>
        </ul>--%>
        <div class="page-header">
            <div class="row">
                <!-- Page header, center on small screens -->
                <%--<h1 class="col-xs-12 col-sm-4 text-center text-left-sm"><i class="fa fa-home page-header-icon"></i>&nbsp;&nbsp;Home</h1>--%>
                <h1 class="col-xs-12 col-sm-8 text-center text-left-sm"><i class="fa fa-home page-header-icon"></i>&nbsp;&nbsp;首页
                </h1>

            </div>
        </div>
        <!-- / .page-header -->
        <div id="main_content" data-url="/home"></div>

    </div>
    <!-- / #content-wrapper -->
    <!-- begin scroll to top btn -->
    <a href="javascript:void(0);" class="btn btn-icon btn-circle btn-success btn-scroll-to-top fade" data-click="scroll-top"><i
            class="fa fa-angle-up"></i></a>
    <!-- end scroll to top btn -->
    <div id="main-menu-bg"></div>
</div>
<!-- / #main-wrapper -->

</body>
<jsp:include page="/WEB-INF/view/jsp/public/include.inc.bottom.jsp" flush="true"/>
<!-- style1 settings script -->
<%--<script src="${pageContext.request.contextPath}/resource/template/style1/settings.js"></script>--%>
<!-- /style1 settings script -->
<script type="text/javascript">
    init.push(function () {
        load("/home");
    });
    window.PixelAdmin.MainMenu.prototype.detectActiveItem = function () {
        var a, bubble, links, nav, predicate, url, _i, _len, _results;
        url = $('#main_content').attr("data-url").replace(contextPath, '').replace(/\#.*?$/, '');
        predicate = PixelAdmin.settings.main_menu.detect_active_predicate;
        nav = $('#main-menu .navigation');
        nav.find('li').removeClass('open active');
        links = nav[0].getElementsByTagName('a');
        bubble = (function (_this) {
            return function (li) {
                li.className += ' active';
                if (!elHasClass(li.parentNode, 'navigation')) {
                    li = li.parentNode.parentNode;
                    li.className += ' open';
                    return bubble(li);
                }
            };
        })(this);
        _results = [];
        for (_i = 0, _len = links.length; _i < _len; _i++) {
            a = links[_i];
            if (a.href.indexOf('#') === -1 && predicate($(a).attr("site"), url)) {
                bubble(a.parentNode);
                break;
            } else {
                _results.push(void 0);
            }
        }
        return _results;
    };


    function activePageHeader(a) {
        var bubble, h1;
        var h1_inner_html = '';
        h1 = $(".page-header").find('h1');
        bubble = (function (_this) {
            return function (li) {
                var span = $(li).find('span');
                var i = $(li).find('i');
                if (h1_inner_html.length > 0) {
                    var temp = h1_inner_html;
                    var icon = i.prop('outerHTML');
                    icon = icon == undefined ? '' : icon;
                    h1_inner_html = icon + ' ' + span.html();
                    h1_inner_html = h1_inner_html + '&nbsp;&nbsp;&gt;&nbsp;&nbsp;' + temp;
                } else {
                    var icon = i.prop('outerHTML');
                    icon = icon == undefined ? '' : icon;
                    h1_inner_html = icon + ' ' + span.html();
                }
                if (!elHasClass(li.parentNode, 'navigation')) {
                    li = li.parentNode.parentNode;
                    return bubble(li);
                }
                h1.html(h1_inner_html);
            };
        })(this);
        if(undefined !== a)
            bubble(a.parentNode);
    }

    var load = function(url,obj){
        url = contextPath + url;
        var $main = $('#main_content');
        $main.attr('data-url',url);
        $main.load(url);
        setTimeout(function(){
            window.PixelAdmin.MainMenu.prototype.detectActiveItem();
            activePageHeader(obj);
        },500);
    };

    var settings = {
        main_menu: {
            detect_active_predicate: function (site, url) {
                return site === url;
            }
        }
    };
    window.PixelAdmin.start(init, settings);

    function logoutFun() {
        bootbox.confirm({
            title:'<span style="font-size: 14px;"><B>提示</B></span>',
            message: "<div style='text-align: left;'><span style='font-size: 14px;'>请问是否退出账号?</span></div>",
            callback:function(res){
                if(res){
                    self.location = "${pageContext.request.contextPath}/logout";
                }
            }
        });
    }

    function notice(settings) {
        //style: default,notice,warning,error
        var options = {};
        options.title = settings.title;
        options.message = settings.msg;
        options.duration = settings.time || 3000;
        options.style = 'notice';
        options.size = 'large';
        $.growl(options);
    }
</script>

<script>
    var _hmt = _hmt || [];
    (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?086cb982114797d6d170557274d1956d";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>
</html>
